﻿using System;
using System.Windows;
using System.Windows.Data;

namespace XmlStudio.Converters {
    class VisibilityFromSelectionConverter : IValueConverter {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            if(value is bool) {
                var val = (bool)value;
                if(val) {
                    return Visibility.Visible;
                }

                return Visibility.Collapsed;
            }

            return null;
        }

        /// <summary>
        /// Returns null.
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns>null.</returns>
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            return null;
        }
    }
}
